﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FindObjs : MonoBehaviour {

    public string[] instantiateName;
    private Peter_InteractiveObj PI;
    private GameObject infoParent;
    private GameObject otherParent;

	// Use this for initialization
	void Start () {
        //info = this.GetComponent<Peter_InteractiveObj>().information.transform;
        //otherObj = this.GetComponent<Peter_InteractiveObj>().otherObj.transform;
        PI = this.GetComponent<Peter_InteractiveObj>();
        InvokeRepeating("Find", 0, 0.1f);
    }
	
	// Update is called once per frame
	void Update ()
    {
        
    }

    private void Find()
    {
        infoParent = GameObject.Find(instantiateName[0]);
        otherParent = GameObject.Find(instantiateName[1]);
        PI.information = infoParent.transform.Find(instantiateName[2]).gameObject;
        PI.otherObj = otherParent.transform.Find(instantiateName[3]).gameObject;
        Debug.Log("isFinding");
    }
}